//
//  DelegateViewController.m
//  iOSCodeLearning
//
//  Created by TFAppleWork-Summer on 2018/4/9.
//  Copyright © 2018年 Ace. All rights reserved.
//

#import "DelegateViewController.h"
#import "DelegateView.h"

@interface DelegateViewController ()<DelegateViewDelegate>

@property (nonatomic, strong) DelegateView *subView;

@end

@implementation DelegateViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.subView];
    self.subView.userInteractionEnabled = YES;
}

-(void)viewClick{
    NSLog(@"点击了delegateView");
}

-(DelegateView*)subView{
    if (!_subView) {
        _subView = [[DelegateView alloc] init];
        _subView.frame = CGRectMake(100, 100, 100, 100);
        _subView.delegate = self;
        _subView.backgroundColor = [UIColor redColor];
    }
    return _subView;
}


-(void)dealloc{
    
    NSLog(@"---------%@---------",NSStringFromClass([self class]));
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
